#include<bits/stdc++.h>
using namespace std;

// 寻找左侧边界的二分搜索

int left_bound(vector<int> nums, int target) {
    if (nums.size() == 0) return -1;
    int l = 0;
    int r = nums.size(); // 注意

    while (l < r) { // 注意
        int mid = (l + r)>>1;
        if (nums[mid] == target) {
            r = mid;
        } else if (nums[mid] < target) {
            l = mid + 1;
        } else if (nums[mid] > target) {
            r = mid; // 注意
        }
    }
    return l;
}

int main(){
    vector<int> nums = {1,3,4,4,4,5,6,7,14,88,133,223,343,999};
    cout<<nums[left_bound(nums,4)-1]<<endl;
    return 0;
}